<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="/css/common.css" />
		<link rel="stylesheet" type="text/css" href="/js/flatpickr.min.css" />
		<link rel="stylesheet" type="text/css" href="/bootstrap-3.3.7/css/bootstrap.min.css" />
		<link rel="stylesheet" type="text/css" href="/dialog/css/dialog.css" />
		<link rel="stylesheet" type="text/css" href="/css/font-awesome.css" />
		<link rel="stylesheet" type="text/css" href="/css/bootstrap-datetimepicker.min.css" />
		<link rel="stylesheet" type="text/css" href="/css/pager.css" />
		<link rel="stylesheet" href="/css/shoufengqin.css">
		<link rel="stylesheet" type="text/css" href="/css/haha.css" media="screen" />
		<link rel="stylesheet" href="/css/b.page.bootstrap3.css" type="text/css"/>
	</head>

	<body>
		<!--顶部导航 -->
        <nav class="topNavItemBox">
            <div id="ItemBox">
                <div class="title">智慧溯源系统</div>
                <div class="subtitle">肉品溯源管理</div>
                <div class="rightUserInfo">
                    <div class="commentAvatarDiv">
                        <img class="commentAvatarImage" src="/images/people.jpg">
                    </div>
                    <div class="userName">
					<#if Session.curEmployeeInfo??>
                        <a href="/admin/logout">${Session.curEmployeeInfo.emName}</a>
					</#if>
                    </div>
                    <span class="glyphicon glyphicon-option-vertical userIcon" aria-hidden="true"></span>
                </div>
            </div>
        </nav>
        <!--检疫查询 -->
        <div class="contain">
        	<#include "leftPage.ftl">
			</div>
			<div id="middle1" class="page_main">
				<div id="middle2" class="page_content">
					<div class="searchGroup">
						<form method="post" action="list">
							<span>供应商编号&nbsp;&nbsp;&nbsp;&nbsp;</span><input type="text" placeholder="请输入供应商编号" name="gId" value="${gId}" class="bigInputtext">
							<span>&nbsp;&nbsp;&nbsp;供应商名称&nbsp;</span><input type="text" placeholder="请输入供应商名称" name="compName" value="${compName}" class="bigInputtext">
							<br/>
							<span>企业类型&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                            <select name="compTypeId" class="bigInputtext">
								<option value>请选择供应商类型</option>
                                <option value="101">疫苗供应商</option>
                                <option value="102">饲料供应商</option>
                            </select>
                            &nbsp;&nbsp;&nbsp;
							<button type="submit" class="btn btn-info btn-sm">搜索</button>
                        </form>
					</div>

                    <div class="buttonGroup">
                        <a href="add" class="btn btn-primary btn-sm" >新增供应商信息</a>
                        <a class="btn btn-danger btn-sm" onclick="deleteByids()">批量删除</a>
                    </div>
					
					<table class="table table-striped table-bordered table-hover table-condensed">
						<thead>
							<tr>
								<th class="selectColumn" ><input type="checkbox" onclick="selectAll()" id="allSelect"></th>
                                <th>供应商编号</th>
                                <th>供应商名称</th>
                                <th>企业类型编码</th>
                                <th>企业类型</th>
                                <th>企业等级</th>
                                <th>注册地址</th>
                                <th>注册资金</th>
                                <th>联系人</th>
                                <th>联系人电话</th>
                                <th>组织机构代码</th>
                                <th>法人</th>
                                <#--<th>法人身份证号</th>-->
                                <th>投诉电话</th>
                                <th>操作</th>
							</tr>
						</thead>
						<tbody>
							<#list page.list as companyInfo>
								<tr>
									<td class="selectColumn"><input type="checkbox" name="isCheck" value="${companyInfo.gid}" /></td>
									<td class="tableElem">${companyInfo.gid}</td>
									<td class="tableElem">${companyInfo.compname}</td>
									<td class="tableElem">${companyInfo.comptypeid}</td>
									<td class="tableElem">
										<#if companyInfo.comptypeid = 101>疫苗供应商
										<#elseif companyInfo.comptypeid = 102>饲料供应商
										<#else>
										</#if>
									</td>
									<td class="tableElem">${companyInfo.companylevel}</td>
									<td class="tableElem">${companyInfo.regaddr}</td>
									<td class="tableElem">${companyInfo.capital}</td>
									<td class="tableElem">${companyInfo.contacts}</td>
									<td class="tableElem">${companyInfo.contactsphone}</td>
									<td class="tableElem">${companyInfo.compcode}</td>
									<td class="tableElem">${companyInfo.legalpname}</td>
									<#--<td class="tableElem">${companyInfo.legalcode}</td>-->
									<td class="tableElem">${companyInfo.complaintphone}</td>
									<td width="140">
										<div class="tableButtonGroup">
											<a class="btn btn-info btn-sm" href="edit?gId=${companyInfo.gid}">修改</a>
											<button type="button" class="btn btn-danger btn-sm" onclick="JavaScript:if(confirm('是否删除')){ delete1(${companyInfo.gid})}">删除</button>
										</div>
									</td>
								</tr>
							</#list>
						</tbody>
					</table>
					<div class="paginationFoot">
						<ul class="pagination" id="page2">
					    </ul>
						<div class="pageJump">
							<span>跳转到</span>
							<input type="text"/>
							<span>页</span>
							<button type="button" class="button">确定</button>
						</div>
					</div>
				</div>
			</div>
		
		</div>
		<!-- <iframe src="left.ftl" frameborder="0"></iframe> -->
		<div class="footer">
			<div class="footer_lineone">
				<span id="logo"></span>肉品溯源管理系统 
				<span class="footer_lineoneSpan"><a href="aboutus.html">关于我们</a></span>
				<span class="footer_lineoneSpan"><a target="_blank" href="http://www.cfsiw.com/">食品安全信息</a></span> 
				<span class="footer_lineoneSpan"><a href="suggestionAdd.ftl">联系我们</a></span>
			</div>
			<div class="footer_linetwo">
				 &copy;2017广东技术师范学院
			</div>
		</div>	

		<script src="/js/jquery-1.9.1.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="/js/google-maps.js" type="text/javascript" charset="utf-8"></script>
		<script src="/js/jquery.form.js"></script>
		<script src="/dialog/js/dialog.js"></script>
		<script src="/js/jquery.validate.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="/js/messages_zh.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="/js/common.js" type="text/javascript" charset="utf-8"></script>
		<script src="/js/bootstrap-datetimepicker.js" type="text/javascript" charset="utf-8"></script>
		<script src="/laydate/laydate.js"></script> <!-- 改成你的路径 -->
		<script type="text/javascript" src="/js/b.page.js" ></script>
		<script src="/js/pager.js"></script>
		<script src="/js/shoufengqin.js"></script>
		<script src="/js/flatpickr.js"></script>
        <script type="text/javascript" charset="UTF-8">
            //全选、全不选
            function selectAll() {
                if ($("#allSelect").is(":checked")) {
                    $("input[name='isCheck']").prop("checked",true);
                } else {
                    $("input[name='isCheck']").prop("checked",false);
                }
            }

            /*异步删除*/
            function delete1(id) {
                $.ajax({
                    type:'post',
                    url:'delete',
                    data:{
                        id : id
                    },
                    success:function(data) {
                        if(data.code == 0){
                            document.location.reload();
                        }else{
                            alert("删除失败");
                        }
                    }
                });
            }

			// /批量删除
            function deleteByids() {
                var option = $("input[name='isCheck']:checked");
                var ids = "";
                for (var i = 0; i< option.length;i++){
                    if(i == 0){
                        ids += option[i].value;
                    }else{
                        ids += "," + option[i].value;
                    }
                }
                $.dialog({
                    type: 'confirm',
                    contentHtml: '<p style:"magrin:0 auto">确认删除？</p>',
                    onClickOk: function() {
                        $.ajax({
                            url: "deleteByIds",
                            data: {
                                'ids': ids
                            },
                            error: function(XMLHttpRequest, textStatus, errorThrown) {
                                //弹失败框
                                $.dialog({
                                    type: 'info',
                                    contentHtml: '<img class="info-icon" src="/dialog/images/icon/fail.png" alt="删除失败" /><p class="info-text">删除失败</p>',
                                    autoClose: 1000
                                });
                            },
                            success: function() {
                                //弹成功框
                                $.dialog({
                                    type: 'info',
                                    contentHtml: '<img class="info-icon" src="/dialog/images/icon/success.png" alt="删除成功" /><p class="info-text">删除成功</p>',
                                    autoClose: 1000
                                });
                                setTimeout("window.location.reload();",500);
                            }
                        });
                    }
                });
            }

            $(function() {
                //初始化侧边栏
                $(".vertical-nav").verticalnav({
                    speed: 400,
                    align: "left"
                });

                //时间选择组件1
                laydate.render({
                    elem: '#test1' //指定元素
                    ,range: true
                });

                //分页组件
                Page({
                    num:7,					//页码数
                    startnum:6,				//指定页码
                    elem:$('#page2'),		//指定的元素
                    callback:function(n){	//回调函数
                        console.log(n);
                    }
                });

                jQuery(document).ready(function($)
                {
                    $('.list22 ul li p').clickdown();
                    $('.list-se p[class=title22]').clickup();
                    $('.list22>ul>li').ad();
                });
            });
        </script>
	</body>
	<style type="text/css">
		#test1{
			width: 155px;
			height: 30px;
		}
		.buttonGroup{
			display: inline-block;
			margin-bottom: 20px;
		}
		.searchGroup{
			display: inline-block;
			float: right;
		}
		.tableButtonGroup{
			text-align: center;
		}
		.paginationFoot{
			text-align: center;
		}
		.contain{
			overflow: hidden;
		}
		.contain #middle1{
            width:100%;
            margin-left:-200px;
            float:left;
            overflow: hidden;
        }
        .contain #middle2{
            margin-left: 280px;
    		margin-right: 30px;
        }
        .contain .left1{
            width:200px;
            float:left;
            min-width: 200px;
        }
	</style>
</html>